home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / cug106 / stdio.lib < prev    next >
Text File  |  1984-06-14  |  2KB  |  59 lines

  1. /*                stdio.lib
  2.  
  3.     Copyright (C) 1980, M J Maney
  4.  
  5.     First created    3/15/80
  6.     Last revised    3/15/80
  7.  
  8.     This library provides the defines and data declarations for the
  9.     stdio functions, which are an attempt to simulate some of the
  10.     things that a really nice OS (like UNIX) gives you in a less nice
  11.     enviornment (BDS C running under CP/M).
  12.  
  13.     To work properly, this file MUST be included into the source of
  14.     any program that wants to use the stdio functions, and the
  15.     library file csym.lib must also be included. These two files
  16.     MUST be the first two files included, and they MUST be included
  17.     in the sequence
  18.  
  19.     #include "csym.lib"
  20.     #include "stdio.lib"
  21.  
  22.     BEFORE any inline declarations of external (global) variables,
  23.     and that includes any such declarations in any other file which
  24.     is included! To be safe, just make the above two lines the first
  25.     non-comment lines of the source. NB that they must be included
  26.     in ALL source files for the program that declare globals!!
  27. */
  28.  
  29. /* define STDIN and STDOUT to work with getc & putc ONLY */
  30. #define STDIN (_stdin==FILE ? _inpbuf : 0)
  31. #define STDOUT (_stdout==FILE ? _outbuf : 1)
  32.  
  33. /* declare globals for stdio functions */
  34. char    _stdin,_stdout;
  35. char    _inpbuf[IOBUFSIZ],_outbuf[IOBUFSIZ];
  36. char    _inpname[FNAMSIZ],_outname[FNAMSIZ];
  37. int    _inpfd,_outfd;
  38. char    _filter;
  39. n() in the
  40.     FIRST character position of an argument.
  41.  
  42.     If the "filter" argument is true, and stdopen finds a STDIN arg,
  43.     but    stdio.doc, an attempt to explain things.
  44.  
  45.     The files that I've sent to the BDS C user's group include the
  46.     early versions of the code I used for simulating the UNIX facility
  47.     for invisible redirection of STDIN and STDOUT files. These
  48.     are not a finished product by any means, and you MUST understand
  49.     their operation to use them sucessfully!
  50.  
  51.     A little history will help. The first version of stdio was written
  52.     before I had recieved the 1.32 (or 1.31+) version of the BDS
  53.     software, and before I decided to rewrite most of the I/O
  54.     functions. I have since been sidetracked and otherwise occupied,
  55.     so that neither of these interlocked projects is completed, and I
  56.     cannot honestly attempt to guess just when such completion may
  57.     occur. So. The files I sent are believed to be the final version
  58.     of the original effort, and will certainly suffice to demonstrate
  59.     the concept I us